package com.wyzz.hr.io.extend;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import jxl.format.Colour;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import org.apache.axis.utils.StringUtils;

import com.wyzz.hr.pojo.OutmatchModel;
import com.wyzz.hr.util.comparator.ListComparator;
import com.wyzz.hr.util.excel.ExcelFormat;
import com.wyzz.hr.util.excel.IExportToExcel;
import com.wyzz.hr.util.output.FieldOperate;
import com.wyzz.hr.util.output.StatisticBgColor;

public class ExportToExcel extends IExportToExcel {

	public ExportToExcel() throws Exception {
		nColNum = 0;
		nRowNum = 0;
		nGroupFieldNum = 0;
		nStatisticNum = 0;
		numberCellFormatMap = new HashMap();
		colorMap = new HashMap();
		colourPointer = 10;
	}

	public ExportToExcel(String filePathName, String outputList[][],
			List fieldList, List statisticList, List groupPlaceList,
			OutmatchModel outmatchModel) throws Exception {
		super(filePathName);
		nColNum = 0;
		nRowNum = 0;
		nGroupFieldNum = 0;
		nStatisticNum = 0;
		numberCellFormatMap = new HashMap();
		colorMap = new HashMap();
		colourPointer = 10;
		setOutputList(outputList);
		setFieldList(fieldList);
		setStatisticList(statisticList);
		setGroupPlaceList(groupPlaceList);
		setOutmatchModel(outmatchModel);
	}

	public void buildContent() throws Exception {
		nColNum = fieldList.size();
		nRowNum = outputList.length;
		nGroupFieldNum = groupPlaceList.size() - 1;
		List groupFieldPlaceList = new ArrayList();
		List statisticFieldPlaceList = new ArrayList();
		for (int i = 0; i < nColNum; i++) {
			if (((FieldOperate) fieldList.get(i)).getStatisticMethod() != null)
				statisticFieldPlaceList.add(Integer.valueOf(i));
			if (Math.abs(((FieldOperate) fieldList.get(i)).getGroupOrder()) == 2)
				groupFieldPlaceList.add(Integer.valueOf(i));
		}

		nStatisticNum = statisticFieldPlaceList.size();
		int nAddSheetNum = 0;
		setCellFormats();
		int nGroupAllNum = 0;
		for (int i = 0; i < nGroupFieldNum + 1; i++)
			nGroupAllNum += ((List) groupPlaceList.get(i)).size() - 1;

		List statisticAllList = new ArrayList();
		if (nGroupFieldNum > 0) {
			int nStatisticPlace[] = new int[nGroupFieldNum + 1];
			for (int i = 0; i < nGroupFieldNum + 1; i++)
				nStatisticPlace[i] = 1;

			for (int i = 1; i < ((List) groupPlaceList.get(0)).size(); i++) {
				int placeTmp1 = ((Integer) ((List) groupPlaceList.get(0))
						.get(i)).intValue();
				int j = 0;
				do {
					if (j >= nGroupFieldNum + 1)
						break;
					int placeTmp = ((Integer) ((List) groupPlaceList.get(j))
							.get(nStatisticPlace[j])).intValue();
					if (placeTmp != placeTmp1)
						break;
					List listTmp = new ArrayList();
					int placePreTmp = ((Integer) ((List) groupPlaceList.get(j))
							.get(nStatisticPlace[j] - 1)).intValue();
					int numTmp = placeTmp - placePreTmp;
					listTmp.add(Integer.valueOf(nGroupFieldNum - j));
					listTmp.add(Integer.valueOf(placeTmp));
					listTmp.add(Integer.valueOf(numTmp));
					for (int k = 0; k < nGroupFieldNum - j; k++)
						listTmp
								.add(outputList[placePreTmp][((Integer) groupFieldPlaceList
										.get(k)).intValue()]);

					if (j > 0) {
						listTmp.add("\u5168\u90E8");
						for (int k = j - 1; k > 0; k--)
							listTmp.add("");

					}
					for (int k = 0; k < nColNum; k++)
						listTmp.add(((List) ((List) statisticList.get(k))
								.get(j)).get(nStatisticPlace[j] - 1));

					statisticAllList.add(listTmp);
					nStatisticPlace[j]++;
					j++;
				} while (true);
			}

		} else {
			List listTmp = new ArrayList();
			listTmp.add(Integer.valueOf(0));
			listTmp.add(Integer.valueOf(nRowNum));
			listTmp.add(Integer.valueOf(nRowNum));
			for (int i = 0; i < nColNum; i++)
				listTmp.add(((List) ((List) statisticList.get(i))
						.get(nGroupFieldNum)).get(0));

			statisticAllList.add(listTmp);
		}
		int existSheetNum = writableWorkbook.getNumberOfSheets();
		if (outmatchModel.getOmmStatisticPlace().intValue() < 3) {
			WritableSheet ws1 = createSheet((new StringBuilder()).append(
					sheetDefaultName).append(existSheetNum).toString(),
					existSheetNum + nAddSheetNum++, writableWorkbook);
			writeSheet(0, nRowNum, ws1, outmatchModel.getOmmNoTitle()
					.intValue());
			if (statisticList != null
					&& outmatchModel.getOmmStatisticPlace().intValue() == 1
					&& nStatisticNum > 0) {
				int rowsDiff = ws1.getRows() - nRowNum;
				for (int i = nGroupAllNum - 1; i >= 0; i--) {
					int insertPlace = ((Integer) ((List) statisticAllList
							.get(i)).get(1)).intValue()
							+ rowsDiff;
					ws1.insertRow(insertPlace);
					for (int j = 0; j < nColNum; j++)
						writeStatisticCell(
								j,
								insertPlace,
								(String) ((List) statisticAllList.get(i)).get(j
										+ 3 + nGroupFieldNum),
								((FieldOperate) fieldList.get(j))
										.getStatisticDataType(),
								ws1,
								statisticCellFormatArr[j][((Integer) ((List) statisticAllList
										.get(i)).get(0)).intValue()]);

					for (int j = 0; j < ((Integer) ((List) statisticAllList
							.get(i)).get(0)).intValue(); j++)
						ws1
								.addCell(new Label(
										((Integer) groupFieldPlaceList.get(j))
												.intValue(),
										insertPlace,
										(String) ((List) statisticAllList
												.get(i)).get(3 + j),
										statisticCellFormatArr[((Integer) groupFieldPlaceList
												.get(j)).intValue()][((Integer) ((List) statisticAllList
												.get(i)).get(0)).intValue()]));

				}

			}
			setRowHeight(ws1);
		}
		if (outmatchModel.getOmmStatisticPlace().intValue() >= 2) {
			WritableSheet ws2 = createSheet(
					(new StringBuilder()).append(statisticSheetDefaultName)
							.append(existSheetNum).toString(), existSheetNum
							+ nAddSheetNum++, writableWorkbook);
			if (outmatchModel.getOmmStatisticDisplayType().intValue() == 0) {
				int colPlaceTmp = 0;
				for (int i = 0; i < nGroupFieldNum; i++) {
					ws2.setColumnView(colPlaceTmp, ((FieldOperate) fieldList
							.get(((Integer) groupFieldPlaceList.get(i))
									.intValue())).getColWidth());
					ws2.addCell(new Label(colPlaceTmp, 0,
							((FieldOperate) fieldList
									.get(((Integer) groupFieldPlaceList.get(i))
											.intValue())).getNormalName(),
							format.getTitleCellFormat()));
					for (int j = 0; j < nGroupAllNum; j++)
						ws2.addCell(new Label(colPlaceTmp, j + 1,
								(String) ((List) statisticAllList.get(j))
										.get(i + 3), format
										.getTitleCellFormat()));

					colPlaceTmp++;
				}

				boolean hasStatistic = false;
				for (int i = 0; i < nColNum; i++) {
					if (((FieldOperate) fieldList.get(i)).getStatisticMethod() == null)
						continue;
					hasStatistic = true;
					ws2.setColumnView(colPlaceTmp, ((FieldOperate) fieldList
							.get(i)).getColWidth());
					ws2.addCell(new Label(colPlaceTmp, 0,
							((FieldOperate) fieldList.get(i))
									.getStatisitcName(), format
									.getTitleCellFormat()));
					for (int j = 0; j < nGroupAllNum; j++)
						writeStatisticCell(
								colPlaceTmp,
								j + 1,
								(String) ((List) statisticAllList.get(j)).get(i
										+ 3 + nGroupFieldNum),
								((FieldOperate) fieldList.get(i))
										.getStatisticDataType(),
								ws2,
								statisticCellFormatArr[i][((Integer) ((List) statisticAllList
										.get(j)).get(0)).intValue()]);

					colPlaceTmp++;
				}

				if (!hasStatistic) {
					ws2.setColumnView(colPlaceTmp, 10);
					ws2.addCell(new Label(colPlaceTmp, 0, "\u8BA1\u6570",
							format.getTitleCellFormat()));
					for (int i = 0; i < nGroupAllNum; i++)
						ws2.addCell(new Number(colPlaceTmp, i + 1,
								((Integer) ((List) statisticAllList.get(i))
										.get(2)).intValue(), format
										.getBodyCellFormat()));

					colPlaceTmp++;
				}
			} else if (nGroupFieldNum > groupLayerInTitle) {
				int rowGroupNum = ((List) groupPlaceList
						.get(nGroupFieldNum - 1)).size();
				List sampleList = new ArrayList();
				for (int i = 0; i < ((List) groupPlaceList.get(0)).size() - 1; i++) {
					List listTmp = new ArrayList();
					listTmp.add(Integer.valueOf(nGroupFieldNum));
					for (int j = groupLayerInTitle; j < nGroupFieldNum; j++)
						listTmp
								.add(outputList[((Integer) ((List) groupPlaceList
										.get(0)).get(i)).intValue()][((Integer) groupFieldPlaceList
										.get(j)).intValue()]);

					sampleList.add(listTmp);
				}

				int orderArr[][] = new int[nGroupFieldNum - 1][2];
				for (int i = 1; i < (nGroupFieldNum - groupLayerInTitle) + 1; i++) {
					orderArr[i - 1][0] = i;
					orderArr[i - 1][1] = ((FieldOperate) fieldList
							.get(((Integer) groupFieldPlaceList.get((i - 1)
									+ groupLayerInTitle)).intValue()))
							.getGroupOrder();
				}

				ListComparator listComparator = new ListComparator(orderArr,
						new int[0]);
				Collections.sort(sampleList, listComparator);
				for (int i = sampleList.size() - 1; i > 0; i--) {
					List listTmp1 = (List) sampleList.get(i - 1);
					List listTmp2 = (List) sampleList.get(i);
					boolean deleteSample = true;
					int j = 1;
					do {
						if (j >= nGroupFieldNum - groupLayerInTitle)
							break;
						if (((String) listTmp1.get(j))
								.compareTo((String) listTmp2.get(j)) != 0) {
							for (int k = j; k < nGroupFieldNum
									- groupLayerInTitle; k++) {
								List listAddTmp = new ArrayList();
								listAddTmp.add(Integer.valueOf(k
										+ groupLayerInTitle));
								for (int l = 1; l < k + 1; l++)
									listAddTmp.add(listTmp1.get(l));

								listAddTmp.add("\u5168\u90E8");
								for (int l = k + 2; l < (nGroupFieldNum - groupLayerInTitle) + 1; l++)
									listAddTmp.add("");

								sampleList.add(i, listAddTmp);
							}

							deleteSample = false;
							break;
						}
						j++;
					} while (true);
					if (deleteSample
							&& ((String) listTmp1.get(nGroupFieldNum
									- groupLayerInTitle))
									.compareTo((String) listTmp2
											.get(nGroupFieldNum
													- groupLayerInTitle)) == 0)
						sampleList.remove(i);
				}

				int nRowGroupNum = sampleList.size();
				for (int i = nGroupFieldNum - groupLayerInTitle - 1; i >= 0; i--) {
					List listTmp = (List) sampleList.get(nRowGroupNum - 1);
					List listAddTmp = new ArrayList();
					listAddTmp.add(Integer.valueOf(i + groupLayerInTitle));
					for (int j = 0; j < i; j++)
						listAddTmp.add(listTmp.get(j + 1));

					listAddTmp.add("\u5168\u90E8");
					for (int j = i + 2; j < (nGroupFieldNum - groupLayerInTitle) + 1; j++)
						listAddTmp.add("");

					sampleList.add(listAddTmp);
				}

				nRowGroupNum = sampleList.size();
				List statistic3dList = new ArrayList();
				List statistic3dTitleList = new ArrayList();
				int indexBgnTmp = 0;
				List statisticNullList = new ArrayList();
				for (int i = 0; i < nColNum; i++)
					statisticNullList.add("");

				for (int i = 0; i < nGroupAllNum - 1; i++) {
					int groupLayerTmp = ((Integer) ((List) statisticAllList
							.get(i)).get(0)).intValue();
					if (groupLayerTmp == groupLayerInTitle) {
						List listTmp = new ArrayList();
						for (int j = indexBgnTmp; j < i + 1; j++)
							listTmp.add(statisticAllList.get(j));

						List listTitleTmp = new ArrayList();
						for (int j = 3; j < 3 + groupLayerInTitle; j++)
							listTitleTmp.add((String) ((List) statisticAllList
									.get(i)).get(j));

						for (int j = 0; j < nRowGroupNum; j++) {
							if (j > listTmp.size() - 1) {
								for (int k = j; k < nRowGroupNum; k++) {
									List listAddTmp1 = new ArrayList();
									listAddTmp1.add(((List) sampleList.get(k))
											.get(0));
									listAddTmp1.add(Integer.valueOf(0));
									listAddTmp1.add(Integer.valueOf(0));
									listAddTmp1.addAll(listTitleTmp);
									listAddTmp1
											.addAll(((List) sampleList.get(k))
													.subList(
															1,
															(nGroupFieldNum - groupLayerInTitle) + 1));
									listAddTmp1.addAll(statisticNullList);
									listTmp.add(listAddTmp1);
								}

								break;
							}
							boolean addNull = false;
							if ((Integer) ((List) sampleList.get(j)).get(0) != (Integer) ((List) listTmp
									.get(j)).get(0))
								addNull = true;
							for (int k = 0; k < nGroupFieldNum
									- groupLayerInTitle
									&& !addNull; k++)
								if (((String) ((List) sampleList.get(j))
										.get(k + 1))
										.compareTo((String) ((List) listTmp
												.get(j)).get(k + 3
												+ groupLayerInTitle)) != 0)
									addNull = true;

							if (addNull) {
								List listAddTmp1 = new ArrayList();
								listAddTmp1.add(((List) sampleList.get(j))
										.get(0));
								listAddTmp1.add(Integer.valueOf(0));
								listAddTmp1.add(Integer.valueOf(0));
								listAddTmp1.addAll(listTitleTmp);
								listAddTmp1
										.addAll(((List) sampleList.get(j))
												.subList(
														1,
														(nGroupFieldNum - groupLayerInTitle) + 1));
								listAddTmp1.addAll(statisticNullList);
								listTmp.add(j, listAddTmp1);
							}
						}

						statistic3dList.add(listTmp);
						statistic3dTitleList.add(listTitleTmp);
						indexBgnTmp = i + 1;
						continue;
					}
					if (groupLayerTmp < groupLayerInTitle)
						indexBgnTmp = i + 1;
				}

				int nColGroupNum = statistic3dTitleList.size();
				for (int i = 0; i < nColGroupNum; i++)
					;
				for (int i = 0; i < nGroupFieldNum - groupLayerInTitle; i++) {
					ws2.setColumnView(i, ((FieldOperate) fieldList
							.get(((Integer) groupFieldPlaceList.get(i
									+ groupLayerInTitle)).intValue()))
							.getColWidth());
					ws2.addCell(new Label(i, groupLayerInTitle,
							((FieldOperate) fieldList
									.get(((Integer) groupFieldPlaceList.get(i
											+ groupLayerInTitle)).intValue()))
									.getStatisitcName(), format
									.getTitleCellFormat()));
					for (int j = 0; j < nRowGroupNum; j++)
						ws2
								.addCell(new Label(
										i,
										j + 1 + groupLayerInTitle,
										(String) ((List) ((List) statistic3dList
												.get(0)).get(j)).get(i + 3
												+ groupLayerInTitle), format
												.getTitleCellFormat()));

				}

				for (int i = 0; i < nColGroupNum; i++) {
					int colPlaceTmp = (nGroupFieldNum - groupLayerInTitle) + i
							* nStatisticNum;
					for (int j = 0; j < groupLayerInTitle; j++) {
						ws2.addCell(new Label(colPlaceTmp, j,
								(String) ((List) statistic3dTitleList.get(i))
										.get(j), format.getTitleCellFormat()));
						ws2.mergeCells(colPlaceTmp, j,
								(colPlaceTmp + nStatisticNum) - 1, j);
					}

					for (int j = 0; j < nStatisticNum; j++) {
						ws2.setColumnView(colPlaceTmp,
								((FieldOperate) fieldList
										.get(((Integer) statisticFieldPlaceList
												.get(j)).intValue()))
										.getColWidth());
						ws2.addCell(new Label(colPlaceTmp, groupLayerInTitle,
								((FieldOperate) fieldList
										.get(((Integer) statisticFieldPlaceList
												.get(j)).intValue()))
										.getStatisitcName(), format
										.getTitleCellFormat()));
						for (int k = 0; k < nRowGroupNum; k++)
							writeStatisticCell(
									colPlaceTmp,
									k + 1 + groupLayerInTitle,
									(String) ((List) ((List) statistic3dList
											.get(i)).get(k))
											.get(((Integer) statisticFieldPlaceList
													.get(j)).intValue()
													+ 3 + nGroupFieldNum),
									((FieldOperate) fieldList
											.get(((Integer) statisticFieldPlaceList
													.get(j)).intValue()))
											.getStatisticDataType(),
									ws2,
									statisticCellFormatArr[((Integer) statisticFieldPlaceList
											.get(j)).intValue()][((Integer) ((List) ((List) statistic3dList
											.get(i)).get(k)).get(0)).intValue()]);

						colPlaceTmp++;
					}

				}

			}
			setRowHeight(ws2);
		}
		if (outmatchModel.getOmmStatisticPlace().intValue() == 3
				&& nGroupFieldNum > 0) {
			List topGroupList = (List) groupPlaceList.get(nGroupFieldNum - 1);
			for (int i = 1; i < topGroupList.size(); i++) {
				String sheetName = outputList[((Integer) topGroupList
						.get(i - 1)).intValue()][((Integer) groupFieldPlaceList
						.get(0)).intValue()];
				Integer sheetappendix = Integer.valueOf(i - 1);
				if (StringUtils.isEmpty(sheetName))
					sheetName = (new StringBuilder()).append(sheetName).append(
							sheetappendix.toString()).toString();
				WritableSheet wsN = createSheet(sheetName, existSheetNum
						+ nAddSheetNum++, writableWorkbook);
				writeSheet(((Integer) topGroupList.get(i - 1)).intValue(),
						((Integer) topGroupList.get(i)).intValue(), wsN,
						outmatchModel.getOmmNoTitle().intValue());
				int insertRowNum = wsN.getRows();
				if (nStatisticNum > 0) {
					for (int j = 0; j < nColNum; j++)
						writeStatisticCell(j, insertRowNum,
								(String) ((List) ((List) statisticList.get(j))
										.get(nGroupFieldNum - 1)).get(i - 1),
								((FieldOperate) fieldList.get(j))
										.getStatisticDataType(), wsN,
								statisticCellFormatArr[j][0]);

				}
				setRowHeight(wsN);
			}

		}
		writableWorkbook.write();
	}

	private void setRowHeight(WritableSheet ws) throws Exception {
		if (outmatchModel.getOmmRowHeight() == null
				|| outmatchModel.getOmmRowHeight().intValue() <= 0)
			return;
		int rowHeight = outmatchModel.getOmmRowHeight().intValue() * 20;
		int rowNum = ws.getRows();
		for (int i = 0; i < rowNum; i++)
			ws.setRowView(i, rowHeight);

	}

	private void setCellFormats() throws Exception {
		colCellFormatArr = new WritableCellFormat[nColNum];
		statisticCellFormatArr = new WritableCellFormat[nColNum][nGroupFieldNum + 1];
		for (int i = 0; i < nColNum; i++) {
			FieldOperate foTmp = (FieldOperate) fieldList.get(i);
			if (foTmp.getDataType().compareTo("decimal") == 0
					&& foTmp.getFormat() != null)
				colCellFormatArr[i] = ExcelFormat
						.createBodyCellFormat(new int[] { (new Integer(
								((FieldOperate) fieldList.get(i)).getFormat()))
								.intValue() });
			else
				colCellFormatArr[i] = ExcelFormat
						.createBodyCellFormat(new int[0]);
			if (((FieldOperate) fieldList.get(i)).getColBgColor() != null)
				setCellBgColor(colCellFormatArr[i], ((FieldOperate) fieldList
						.get(i)).getColBgColor());
			for (int j = 0; j < nGroupFieldNum + 1; j++) {
				if (foTmp.getStatisticDataType() != null
						&& foTmp.getStatisticDataType().compareTo("decimal") == 0
						&& foTmp.getStatisticFormat() != null)
					statisticCellFormatArr[i][j] = ExcelFormat
							.createBodyCellFormat(new int[] { (new Integer(
									((FieldOperate) fieldList.get(i))
											.getStatisticFormat())).intValue() });
				else if (foTmp.getStatisticDataType() != null
						&& foTmp.getStatisticDataType().compareTo("integer") == 0)
					statisticCellFormatArr[i][j] = ExcelFormat
							.createBodyCellFormat(new int[] { 0 });
				else
					statisticCellFormatArr[i][j] = ExcelFormat
							.createBodyCellFormat(new int[0]);
				if (j != nGroupFieldNum
						|| outmatchModel.getOmmStatisticPlace().intValue() <= 1)
					setStatisticCellBgColor(statisticCellFormatArr[i][j], j);
			}

		}

	}

	private void writeSheet(int indexBgn, int indexEnd, WritableSheet ws,
			int needTitle) throws Exception {
		label0: for (int i = 0; i < nColNum; i++) {
			FieldOperate foTmp = (FieldOperate) fieldList.get(i);
			ws.setColumnView(i, foTmp.getColWidth());
			int rowAdd = 0;
			if (needTitle == 0) {
				ws.addCell(new Label(i, 0, foTmp.getNormalName(), format
						.getTitleCellFormat()));
				rowAdd = 1;
			}
			if ("integer".compareTo(foTmp.getDataType()) == 0
					|| "decimal".compareTo(foTmp.getDataType()) == 0) {
				int j = indexBgn;
				do {
					if (j >= indexEnd)
						continue label0;
					if (outputList[j][i].length() > 0)
						ws.addCell(new Number(i, (j - indexBgn) + rowAdd,
								(new Double(outputList[j][i])).doubleValue(),
								colCellFormatArr[i]));
					else
						ws.addCell(new Label(i, (j - indexBgn) + rowAdd,
								outputList[j][i], colCellFormatArr[i]));
					j++;
				} while (true);
			}
			for (int j = indexBgn; j < indexEnd; j++)
				ws.addCell(new Label(i, (j - indexBgn) + rowAdd,
						outputList[j][i], colCellFormatArr[i]));

		}

	}

	private void writeStatisticCell(int col, int row, String content,
			String dataType, WritableSheet ws, WritableCellFormat wcFormat)
			throws Exception {
		if (dataType != null
				&& content.length() > 0
				&& ("integer".compareTo(dataType) == 0 || "decimal"
						.compareTo(dataType) == 0))
			ws.addCell(new Number(col, row,
					(new Double(content)).doubleValue(), wcFormat));
		else
			ws.addCell(new Label(col, row, content, wcFormat));
	}

	private void setCellBgColor(WritableCellFormat cf, java.awt.Color color)
			throws Exception {
		if (colorMap.containsKey(color)) {
			cf.setBackground((Colour) colorMap.get(color));
		} else {
			ExportToExcel _tmp = this;
			writableWorkbook.setColourRGB(jxlColours[colourPointer], color
					.getRed(), color.getGreen(), color.getBlue());
			ExportToExcel _tmp1 = this;
			cf.setBackground(jxlColours[colourPointer]);
			ExportToExcel _tmp2 = this;
			colorMap.put(color, jxlColours[colourPointer]);
			colourPointer++;
		}
	}

	private void setStatisticCellBgColor(WritableCellFormat cf, int layer)
			throws Exception {
		java.awt.Color color = StatisticBgColor.getBgColor(layer);
		setCellBgColor(cf, color);
	}

	public String[][] getOutputList() {
		return outputList;
	}

	public List getFieldList() {
		return fieldList;
	}

	public List getStatisticList() {
		return statisticList;
	}

	public List getGroupPlaceList() {
		return groupPlaceList;
	}

	public OutmatchModel getOutmatchModel() {
		return outmatchModel;
	}

	public void setOutputList(String outputList[][]) {
		this.outputList = outputList;
	}

	public void setFieldList(List fieldList) {
		this.fieldList = fieldList;
	}

	public void setStatisticList(List statisticList) {
		this.statisticList = statisticList;
	}

	public void setGroupPlaceList(List groupPlaceList) {
		this.groupPlaceList = groupPlaceList;
	}

	public void setOutmatchModel(OutmatchModel outmatchModel) {
		this.outmatchModel = outmatchModel;
	}

	public static final String StatisticAllName = "\u5168\u90E8";
	private static int groupLayerInTitle = 1;
	private String outputList[][];
	private List fieldList;
	private List statisticList;
	private List groupPlaceList;
	private OutmatchModel outmatchModel;
	private int nColNum;
	private int nRowNum;
	private int nGroupFieldNum;
	private int nStatisticNum;
	private WritableCellFormat statisticCellFormatArr[][];
	private Map numberCellFormatMap;
	private WritableCellFormat colCellFormatArr[];
	private Map colorMap;
	private static Colour jxlColours[] = Colour.getAllColours();
	private int colourPointer;

}
